<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>物流信息</title>
<style type="text/css">
    .uploader-blank{padding-top: 15px; width:158px;}
    .uploader-list{margin-bottom: 10px; position: relative;}
    .uploader-list img{height: 112px; width: 145px; border:#ccc 1px solid; padding: 5px;}
</style>
</head>
<body>
<div class="pd-20">
  <form action="" method="post" class="form form-horizontal" name="form1" id="form1">
    <div class="row cl">
        <input type="hidden" value="0" name="aid" id="aid">
      <!--   <input type="hidden" value="" name="did" id="did"> -->
        <label class="form-label col-2"><span class="c-red">*</span>物流公司：</label>
        <div class="formControls col-6 s-msg">
            <span class="select-box">
                <input type="hidden" name="shipping_name" id="shipping_name">
                <select name="shipping_code" class="select" id="shipping_code" nullmsg="请选择省份！" required>
                    <option value="">请选择快递</option>
                </select>
            </span> 
        </div>
        <div class="col-2"> </div>
    </div>

    <div class="row cl">
        <label class="form-label col-2"><span class="c-red">*</span>订单编号：</label>
        <div class="formControls col-6 s-msg">
            <input type="text" class="input-text" placeholder="订单" id="shipping_num" name="shipping_num" nullmsg="订单不能为空！">
        </div>
        <div class="col-3 c-999" style="line-height: 32px;">多个编号用 , 隔开</div>
    </div>
    
    <div class="row cl">
        <label class="form-label col-2">备注：</label>
        <div class="formControls col-8">
            <textarea name="remark" id="remark" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入3个字符"  dragonfly="true" onKeyUp="textarealength(this,100)"></textarea>
            <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
        </div>
        <div class="col-4"> </div>
    </div>
    <div class="row cl">
        <div class="col-9 col-offset-3">
            <input class="btn btn-primary radius" type="submit" id="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
        </div>
    </div>
    </form>
    <div class="row cl pt-20 mt-20" style="border-top: #ccc 1px dashed;">
        <label class="form-label col-2 text-r">物流信息：</label>
        <div class="formControls col-9" id="transdetail">
            加载中...
        </div>
        
    </div>
</div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 

<script type="text/javascript" src="lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script>
<script type="text/javascript" src="js/s.js"></script> 
<script type="text/javascript">
$(function(){
    
    var order_state=getUrlParam('order_state');
    var aid=getUrlParam('aid');
    var sid=getUrlParam('sid');

    
    if(order_state!=null){
        $("#form1").attr("action", API_APPLYLIST);
        $("#aid").val(aid);
    }else{
        parent.parent.layer.msg("缺少参数", {icon:3,time:1000});
    }
    $("#shipping_code").change(function(){
        var checkText=$("#shipping_code").find("option:selected").text();
        $("#shipping_name").val(checkText);
    })



    if(order_state==3){
        var eidturl=API_APPLYLIST+"?aid="+aid;
        $.getJSON(eidturl,function(data){
            if(!checkStatus(data)) return;//判断登录
            var shipping_code=data.datas.shipping_code;
            for(var i in shippinglist){
              
                if(shippinglist[i].code==shipping_code){
                    $("#shipping_num").val(data.datas.shipping_num);
                    $("#shipping_code").append('<option value="'+shippinglist[i].code+'" selected>'+shippinglist[i].name+'</option>');
                    $("#shipping_name").val(shippinglist[i].name);
                }else{
                    $("#shipping_code").append('<option value="'+shippinglist[i].code+'">'+shippinglist[i].name+'</option>');
                }
                
            }

            if(data.datas==''){
                layer.msg("数据加载错误", {icon:2,time:1000});
            }else{
                
                $("#shipping_num").val(data.datas.shipping_num);
                $("#remark").val(data.datas.remark);              
                $("#form1").attr("action", eidturl);  

                $.getJSON(API_EXPRESS,{
                    express_code:shipping_code,
                    express_id:sid,
                },function(data){
                    if(data.datas.Success){
                        if(data.datas.State=="0" && data.datas.Reason=="此单无物流信息"){
                             $("#transdetail").html("暂无物流信息");
                        }else{
                            var list=data.datas.Traces;
                            $("#transdetail").html("");
                            for(x in list){
                                $("#transdetail").append('<li>· '+list[x].AcceptStation+'<p>'+list[x].AcceptTime+'</p></li>');
                            }
                        }
                        
                        

                    }else{

                        parent.parent.layer.msg("物流信息查询失败", {icon:3,time:1000});
                    }
                    
                }) 
            }  
        })
    }else{
        for(var i in shippinglist){        
            $("#shipping_code").append('<option value="'+shippinglist[i].code+'">'+shippinglist[i].name+'</option>');             
        }
    }

    Validformsubmit("#form1");
});



</script>
</body>
</html>